<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>币安K线高级统计分析</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="/assets/css/statistics.css">
</head>
<body>
    <div class="container-fluid">
        <header class="mb-4 pt-3">
            <div class="d-flex justify-content-between align-items-center">
                <h1>币安K线高级统计分析</h1>
                <a href="/" class="btn btn-outline-primary">返回主页</a>
            </div>
            <hr>
        </header>
        
        <div class="row mb-4">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header bg-primary text-white">
                        <h4 class="mb-0">统计参数设置</h4>
                    </div>
                    <div class="card-body">
                        <form id="statsForm" class="row g-3">
                            <div class="col-md-3">
                                <label for="symbol" class="form-label">交易对</label>
                                <select id="symbol" class="form-select">
                                    <option value="BTCUSDT">BTCUSDT</option>
                                    <option value="ETHUSDT">ETHUSDT</option>
                                </select>
                            </div>
                            <div class="col-md-3">
                                <label for="interval" class="form-label">时间周期</label>
                                <select id="interval" class="form-select">
                                    <option value="10m">10分钟</option>
                                    <option value="30m">30分钟</option>
                                    <option value="1h">1小时</option>
                                    <option value="1d">1天</option>
                                </select>
                            </div>
                            <div class="col-md-3">
                                <label for="timeRange" class="form-label">时间范围</label>
                                <select id="timeRange" class="form-select">
                                    <option value="3m">最近3个月</option>
                                    <option value="6m">最近6个月</option>
                                    <option value="1y" selected>最近1年</option>
                                    <option value="2y">最近2年</option>
                                    <option value="all">全部数据</option>
                                </select>
                            </div>
                            <div class="col-md-3 d-flex align-items-end">
                                <button type="submit" class="btn btn-primary">生成统计分析</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row mb-4">
            <div class="col-md-12">
                <ul class="nav nav-tabs" id="statsTabs" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active" id="time-tab" data-bs-toggle="tab" data-bs-target="#time-stats" type="button" role="tab">时间模式分析</button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="pattern-tab" data-bs-toggle="tab" data-bs-target="#pattern-stats" type="button" role="tab">K线形态分析</button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="multi-tab" data-bs-toggle="tab" data-bs-target="#multi-stats" type="button" role="tab">多维交叉分析</button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="prediction-tab" data-bs-toggle="tab" data-bs-target="#prediction-stats" type="button" role="tab">趋势预测分析</button>
                    </li>
                </ul>
                
                <div class="tab-content p-3 border border-top-0 rounded-bottom" id="statsTabContent">
                    <!-- 时间模式分析 -->
                    <div class="tab-pane fade show active" id="time-stats" role="tabpanel">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>小时分布统计</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="hourlyChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>周内日分布统计</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="weekdayChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>工作日vs周末对比</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="weekendChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>美股交易时段表现</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="usMarketChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- K线形态分析 -->
                    <div class="tab-pane fade" id="pattern-stats" role="tabpanel">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>K线类型分布</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="candleTypeChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>连续涨跌统计</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="consecutiveChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="card mb-4">
                                    <div class="card-body" id="consecutiveTableContainer">
                                        <!-- 这里将通过JS动态生成连续涨跌记录表格 -->
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>特殊形态识别</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="patternRecognitionTable" class="table-responsive"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 多维交叉分析 -->
                    <div class="tab-pane fade" id="multi-stats" role="tabpanel">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>成交量与价格关系</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="volumePriceChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>时段波动率对比</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="volatilityChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>BTC/ETH相关性分析</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="correlationChart" style="height: 400px;"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 趋势预测分析 -->
                    <div class="tab-pane fade" id="prediction-stats" role="tabpanel">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>连续形态后续走势概率</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="futureDirectionChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>历史形态相似度</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="similarityChart" style="height: 300px;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                                <div class="card mb-4">
                                    <div class="card-header">
                                        <h5>形态预测模型</h5>
                                    </div>
                                    <div class="card-body">
                                        <div id="predictionModelContainer" style="height: 400px;"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.2/dist/echarts.min.js"></script>
    <script src="/assets/js/statistics.js"></script>
</body>
</html> 